package org.jeecg.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.jeecg.domain.Collect;
import org.jeecg.domain.Fans;
import org.jeecg.domain.User;

import java.util.List;

@Mapper
public interface FansMapper {


    @Select("select * from sys_user u where EXISTS (select 1 from fans f where username = #{username} and f.fans_username = u.username)")
    List<User> getFans(String username);

    @Insert("insert into fans (id,username,fans_username,create_time) values (#{id},#{username},#{fansUsername},#{createTime});")
    Integer insertFans(Fans fans);

    @Select("select * from fans where username = #{username} and fans_username = #{fansUsername}")
    Fans queryFan(String username, String fansUsername);

    @Delete("delete from fans where username = #{username} and fans_username = #{fansUsername}")
    Integer deleteFans(String username,String fansUsername);

}
